// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** downloadMonthlyPlanningData GET /monthly-planning/download */
export async function downloadMonthlyPlanningDataUsingGET(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.downloadMonthlyPlanningDataUsingGETParams,
  options?: { [key: string]: any },
) {
  return request<any>('/monthly-planning/download', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** listMonthlyPlanningKeyProcessDTO GET /monthly-planning/key-process */
export async function listMonthlyPlanningKeyProcessDTOUsingGET(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listMonthlyPlanningKeyProcessDTOUsingGETParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseListMonthlyPlanningKeyProcessDTO_>(
    '/monthly-planning/key-process',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/** editMonthlyPlanningKeyProcess PUT /monthly-planning/key-process */
export async function editMonthlyPlanningKeyProcessUsingPUT(
  body: API.EditMonthlyPlanningKeyProcessQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/key-process', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** addMonthlyPlanningKeyProcess POST /monthly-planning/key-process */
export async function addMonthlyPlanningKeyProcessUsingPOST(
  body: API.AddMonthlyPlanningKeyProcessQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/key-process', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** deleteMonthlyPlanningKeyProcess DELETE /monthly-planning/key-process */
export async function deleteMonthlyPlanningKeyProcessUsingDELETE(
  body: API.DeleteMonthlyPlanningKeyProcessQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/key-process', {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** listMonthlyPlanningNumberDTO GET /monthly-planning/number */
export async function listMonthlyPlanningNumberDTOUsingGET(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listMonthlyPlanningNumberDTOUsingGETParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseListMonthlyPlanningNumberDTO_>('/monthly-planning/number', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** editMonthlyPlanningNumber PUT /monthly-planning/number */
export async function editMonthlyPlanningNumberUsingPUT(
  body: API.EditMonthlyPlanningNumberQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/number', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** addMonthlyPlanningNumber POST /monthly-planning/number */
export async function addMonthlyPlanningNumberUsingPOST(
  body: API.AddMonthlyPlanningNumberQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/number', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** deleteMonthlyPlanningNumber DELETE /monthly-planning/number */
export async function deleteMonthlyPlanningNumberUsingDELETE(
  body: API.DeleteMonthlyPlanningNumberQuery,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/monthly-planning/number', {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** upload POST /monthly-planning/upload */
export async function uploadUsingPOST2(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.uploadUsingPOST2Params,
  body: string,
  options?: { [key: string]: any },
) {
  const formData = new FormData();

  Object.keys(body).forEach((ele) => {
    const item = (body as any)[ele];

    if (item !== undefined && item !== null) {
      if (typeof item === 'object' && !(item instanceof File)) {
        if (item instanceof Array) {
          item.forEach((f) => formData.append(ele, f || ''));
        } else {
          formData.append(ele, JSON.stringify(item));
        }
      } else {
        formData.append(ele, item);
      }
    }
  });

  return request<API.BaseResponseString_>('/monthly-planning/upload', {
    method: 'POST',
    params: {
      ...params,
    },
    data: formData,
    requestType: 'form',
    ...(options || {}),
  });
}
